From 0a0daced7c1874c50d263e9a53073db8d209bd21 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C3=98yvind=20Kol=C3=A5s?= Date: Mon, 16 Jul 2018 18:15:56 +0200 Subject: [PATCH] babl: harmonize naming of space constructors babl_icc_make_space remains for compatibility so older versions of gimp do not get upset, the gimp-2.10 release depends on this symbol. --- babl/babl-icc.c | 14 +++++++++-- babl/babl-internal.h | 16 ------------- babl/babl-space.c | 51 +++++++++++++++++++-------------------- babl/babl.h | 57 +++++++++++++++++++++++++++++++++++--------- export-symbols | 14 ++++++----- 5 files changed, 91 insertions(+), 61 deletions(-) diff --git a/babl/babl-icc.c b/babl/babl-icc.c index b5a9c86..7f38c99 100644 --- a/babl/babl-icc.c +++ b/babl/babl-icc.c @@ -721,7 +721,7 @@ static char *decode_string (ICC *state, const char *tag, const char *lang, const } const Babl * -babl_icc_make_space (const char *icc_data, +babl_space_from_icc (const char *icc_data, int icc_length, BablIccIntent intent, const char **error) @@ -907,7 +907,7 @@ babl_icc_make_space (const char *icc_data, double wZ = icc_read (s15f16, offset + 8 + 4 * 2); babl_free (state); - ret = (void*) babl_chromaticities_make_space (NULL, + ret = (void*) babl_space_from_chromaticities (NULL, wX / (wX + wY + wZ), wY / (wX + wY + wZ), red_x, red_y, @@ -928,6 +928,16 @@ babl_icc_make_space (const char *icc_data, return NULL; } +/* NOTE: GIMP-2.10.0-4 releases depends on this symbol */ +const Babl * +babl_icc_make_space (const char *icc_data, + int icc_length, + BablIccIntent intent, + const char **error) +{ + return babl_space_from_icc (icc_data, icc_length, intent, error); +} + static void symmetry_test (ICC *state) { icc_write (s8, 8,-2); diff --git a/babl/babl-internal.h b/babl/babl-internal.h index 08530b8..a6f1196 100644 --- a/babl/babl-internal.h +++ b/babl/babl-internal.h @@ -385,22 +385,6 @@ const Babl *babl_space_match_trc_matrix (const Babl *trc_red, float bx, float by, float bz); -/** - * babl_space_from_rgbxyz_matrix: - * - * Creates a new RGB matrix color space definition using a precomputed D50 - * adapted 3x3 matrix and associated CIE XYZ whitepoint, as possibly read from - * an ICC profile. - */ -const Babl * -babl_space_from_rgbxyz_matrix (const char *name, - double wx, double wy, double wz, - double rx, double gx, double bx, - double ry, double gy, double by, - double rz, double gz, double bz, - const Babl *trc_red, - const Babl *trc_green, - const Babl *trc_blue); int _babl_file_get_contents (const char *path, diff --git a/babl/babl-space.c b/babl/babl-space.c index 0035182..482a21c 100644 --- a/babl/babl-space.c +++ b/babl/babl-space.c @@ -313,16 +313,15 @@ babl_space_from_rgbxyz_matrix (const char *name, return (Babl*)&space_db[i]; } -const Babl * -babl_chromaticities_make_space (const char *name, - double wx, double wy, - double rx, double ry, - double gx, double gy, - double bx, double by, - const Babl *trc_red, - const Babl *trc_green, - const Babl *trc_blue, - BablSpaceFlags flags) +const Babl * babl_space_from_chromaticities (const char *name, + double wx, double wy, + double rx, double ry, + double gx, double gy, + double bx, double by, + const Babl *trc_red, + const Babl *trc_green, + const Babl *trc_blue, + BablSpaceFlags flags) { int i=0; static BablSpace space; @@ -391,14 +390,14 @@ void babl_space_class_init (void) { #if 0 - babl_chromaticities_make_space ("sRGB", + babl_space_from_chromaticities ("sRGB", 0.3127, 0.3290, /* D65 */ 0.6400, 0.3300, 0.3000, 0.6000, 0.1500, 0.0600, babl_trc("sRGB"), NULL, NULL, 1); #else - babl_chromaticities_make_space ("sRGB", + babl_space_from_chromaticities ("sRGB", 0.3127, 0.3290, /* D65 */ 0.639998686, 0.330010138, 0.300003784, 0.600003357, @@ -408,7 +407,7 @@ babl_space_class_init (void) /* hard-coded pre-quantized values - to match exactly what is used in standards see issue #18 */ #endif - babl_chromaticities_make_space ("Rec2020", + babl_space_from_chromaticities ("Rec2020", 0.3127, 0.3290, /* D65 */ 0.708, 0.292, 0.170, 0.797, @@ -416,7 +415,7 @@ babl_space_class_init (void) // XXX: is using sRGB TRC right? babl_trc("sRGB"), NULL, NULL, 1); - babl_chromaticities_make_space ( + babl_space_from_chromaticities ( "Adobish", /* a space that can be used as a place-holder for a sRGB like space with displaced green coordinates from a big graphics software vendor that would rather not it's name be directly used when referring to this color space, @@ -428,7 +427,7 @@ computations of uniform gray axis */ 0.1500, 0.0600, babl_trc("2.2"), NULL, NULL, 1); - babl_chromaticities_make_space ( + babl_space_from_chromaticities ( "ProPhoto", 0.34567, 0.3585, /* D50 */ 0.7347, 0.2653, @@ -436,7 +435,7 @@ computations of uniform gray axis */ 0.0366, 0.0001, babl_trc("1.8"), NULL, NULL, 1); - babl_chromaticities_make_space ( + babl_space_from_chromaticities ( "Apple", 0.3127, 0.3290, /* D65 */ 0.6250, 0.3400, @@ -445,7 +444,7 @@ computations of uniform gray axis */ babl_trc("1.8"), NULL, NULL, 1); #if 0 - babl_chromaticities_make_space ( + babl_space_from_chromaticities ( "WideGamut", 0.34567, 0.3585, /* D50 */ 0.7350, 0.2650, @@ -453,7 +452,7 @@ computations of uniform gray axis */ 0.1570, 0.0180, babl_trc("2.2"), NULL, NULL, 1); - babl_chromaticities_make_space ( + babl_space_from_chromaticities ( "Best", 0.34567, 0.3585, /* D50 */ 0.7347, 0.2653, @@ -461,7 +460,7 @@ computations of uniform gray axis */ 0.1300, 0.0350, babl_trc("2.2"), NULL, NULL, 1); - babl_chromaticities_make_space ( + babl_space_from_chromaticities ( "Beta", 0.34567, 0.3585, /* D50 */ 0.6888, 0.3112, @@ -469,7 +468,7 @@ computations of uniform gray axis */ 0.1265, 0.0352, babl_trc("2.2"), NULL, NULL, 1); - babl_chromaticities_make_space ( + babl_space_from_chromaticities ( "Bruce", 0.3127, 0.3290, /* D65 */ 0.6400, 0.3300, @@ -477,7 +476,7 @@ computations of uniform gray axis */ 0.1500, 0.0600, babl_trc("1.8"), NULL, NULL); - babl_chromaticities_make_space ( + babl_space_from_chromaticities ( "PAL", 0.3127, 0.3290, /* D65 */ 0.6400, 0.3300, @@ -485,7 +484,7 @@ computations of uniform gray axis */ 0.1500, 0.0600, babl_trc("2.2"), NULL, NULL, 1); - babl_chromaticities_make_space ( + babl_space_from_chromaticities ( "SMPTE-C", 0.3127, 0.3290, /* D65 */ 0.6300, 0.3300, @@ -493,7 +492,7 @@ computations of uniform gray axis */ 0.1550, 0.0700, babl_trc("2.2"), NULL, NULL, 1); - babl_chromaticities_make_space ( + babl_space_from_chromaticities ( "ColorMatch", 0.34567, 0.3585, /* D50 */ 0.6300, 0.3400, @@ -501,7 +500,7 @@ computations of uniform gray axis */ 0.1500, 0.0750, babl_trc("1.8"), NULL, NULL, 1); - babl_chromaticities_make_space ( + babl_space_from_chromaticities ( "Don RGB 4", 0.34567, 0.3585, /* D50 */ 0.6960, 0.3000, @@ -510,7 +509,7 @@ computations of uniform gray axis */ babl_trc("1.8"), NULL, NULL, 1); #endif - babl_chromaticities_make_space ( + babl_space_from_chromaticities ( "ACEScg", 0.32168, 0.33767, 0.713, 0.293, @@ -518,7 +517,7 @@ computations of uniform gray axis */ 0.128, 0.044, babl_trc("linear"), NULL, NULL, 1); - babl_chromaticities_make_space ( + babl_space_from_chromaticities ( "ACES2065-1", 0.32168, 0.33767, 0.7347, 0.2653, diff --git a/babl/babl.h b/babl/babl.h index e6e2766..9516024 100644 --- a/babl/babl.h +++ b/babl/babl.h @@ -99,7 +99,7 @@ typedef enum { } BablIccIntent; /** - * babl_icc_make_space: + * babl_space_from_icc: * * @icc_data: pointer to icc profile in memory * @icc_length: length of icc profile in bytes @@ -121,6 +121,12 @@ typedef enum { * containing a message describing why the provided data does not yield a babl * space. */ +const Babl *babl_space_from_icc (const char *icc_data, + int icc_length, + BablIccIntent intent, + const char **error); + +// XXX : deprecated const Babl *babl_icc_make_space (const char *icc_data, int icc_length, BablIccIntent intent, @@ -456,8 +462,19 @@ typedef enum { BABL_SPACE_FLAG_EQUALIZE = 1 } BablSpaceFlags; +// XXX: deprecated +const Babl * babl_space_from_chromaticities (const char *name, + double wx, double wy, + double rx, double ry, + double gx, double gy, + double bx, double by, + const Babl *trc_red, + const Babl *trc_green, + const Babl *trc_blue, + BablSpaceFlags flags); + /** - * babl_space_from_chromaticities: + * babl_space_from_chromaticities * * Creates a new babl-space/ RGB matrix color space definition with the * specified CIE xy(Y) values for white point: wx, wy and primary @@ -467,15 +484,15 @@ typedef enum { * Internally this does the math to derive the RGBXYZ matrix as used in an ICC * profile. */ -const Babl * babl_chromaticities_make_space (const char *name, - double wx, double wy, - double rx, double ry, - double gx, double gy, - double bx, double by, - const Babl *trc_red, - const Babl *trc_green, - const Babl *trc_blue, - BablSpaceFlags flags); +const Babl * babl_space_from_chromaticities (const char *name, + double wx, double wy, + double rx, double ry, + double gx, double gy, + double bx, double by, + const Babl *trc_red, + const Babl *trc_green, + const Babl *trc_blue, + BablSpaceFlags flags); /** @@ -529,6 +546,24 @@ void babl_space_get (const Babl *space, */ const char *babl_space_get_icc (const Babl *babl, int *length); +/** + * babl_space_from_rgbxyz_matrix: + * + * Creates a new RGB matrix color space definition using a precomputed D50 + * adapted 3x3 matrix and associated CIE XYZ whitepoint, as possibly read from + * an ICC profile. + */ +const Babl * +babl_space_from_rgbxyz_matrix (const char *name, + double wx, double wy, double wz, + double rx, double gx, double bx, + double ry, double gy, double by, + double rz, double gz, double bz, + const Babl *trc_red, + const Babl *trc_green, + const Babl *trc_blue); + + #ifdef __cplusplus } #endif diff --git a/export-symbols b/export-symbols index 130f616..be9d4c6 100644 --- a/export-symbols +++ b/export-symbols @@ -25,8 +25,6 @@ babl_get_name babl_get_name babl_get_user_data babl_get_version -babl_icc_make_space -babl_icc_get_key babl_init babl_introspect babl_malloc @@ -42,18 +40,22 @@ babl_process_rows babl_sampling babl_set_user_data babl_space -babl_space_from_xyz -babl_space_get_icc -babl_chromaticities_make_space +babl_space_from_rgbxyz_matrix +babl_space_from_chromaticities +babl_space_from_icc babl_space_get babl_space_get_rgbtoxyz +babl_space_get_icc babl_space_to_xyz +babl_space_from_xyz +babl_space_to_icc +babl_icc_make_space +babl_icc_get_key babl_ticks babl_type babl_type_new babl_trc babl_trc_gamma -babl_space_to_icc babl_db_exist_by_name babl_db_find babl_db_init -- 2.30.2